<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/list.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/lib/bp.css">
	<style type="text/css">
		a:hover{
			cursor: pointer;
		}
		.breadcrumb,.breadcrumb li{
			font-size:20px;
			line-height: 50px;
		}
		.breadcrumb{
			padding: 28px 15px;
		}
		.form-control{
			display: inline-block;
			width: 270px;
			margin-right: 10px;
		}
		.btn-primary{
			line-height: auto;
		}
		.table tr{
			height: 45px;
		}
		.table > tbody > tr > td{
		    vertical-align: middle;
		}
	</style>

</head>
<body style="margin: 25px 0;">
	<div style="line-height: 50px;background: #f5f5f5;position: relative;">
		<ol class="breadcrumb">
			<li>公寓管理</li>	
			<li>租户信息</li>
		</ol>
		<div class="searchMes">
			<form action="${pageContext.request.contextPath}/lessee/search" method="post" class="forms">
				<input  class="form-control" placeholder="租户查询" name="name"/>
				<input type="submit" value="搜索" class="btn btn-primary" />
			</form>
		</div>
		<!-- ${pageContext.request.contextPath}/house/add -->
		<a class="btn btn-primary add_button" onclick="parent.location.href='${pageContext.request.contextPath}/lessee/add'">添加</a>
	</div>
	<div style=""> <!-- background-color: #f5f5f5 -->
		<table class="table table-striped table-hover table-bordered">
			<thead>
				<tr style="background: #E5E5E5">
					<th>姓名</th>
					<th>电话</th>
					<th>性别</th>
					<th>籍贯</th>
					<th>身份证号</th>
					<th>添加时间</th>
					<th style="width: 200px;">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${lesseeMes.list}" var="c">
					<tr>
						<td>${c.l_name}</td>
						<td>${c.l_tel}</td>
						<td>${c.l_sex=='0'?'男':'女'}</td>
						<td>${c.l_native_place}</td>
						<td>${c.l_id_card}</td>
						<td>
							<f:formatDate value="${c.l_add_time}" pattern="yyyy年MM月dd日  HH:mm分"/>
						</td>
						<td>
							<a onclick="parent.location.href='${pageContext.request.contextPath}/lessee/findLesseeMesByid?id=${c.l_id}'" style="padding: 0 10px;">编辑</a>
							<a onclick="deleteLessee(${c.l_id},'${pageContext.request.contextPath}')">删除</a>
						</td>
					</tr>
				</c:forEach>
				<tr class="page">
					<td colspan="10">
						<nav aria-label="Page navigation">
						  <ul class="pagination">
						    <li>
						      <a href="${pageContext.request.contextPath}/lessee/lesseeList?index=${lesseeMes.pageNum==1?'1':lesseeMes.pageNum-1}" aria-label="Previous">
						        <span aria-hidden="true">&laquo;</span>
						      </a>
						    </li>
						    <c:forEach items="${lesseeMes.navigatepageNums }" var="c">
						    	<li class="${c==lesseeMes.pageNum?'active':'' }">
						    		<a href="${pageContext.request.contextPath}/lessee/lesseeList?index=${c}">${c }</a>
						    	</li>
					    	</c:forEach>
						    <li>
						      <a href="${pageContext.request.contextPath}/lessee/lesseeList?index=${lesseeMes.pageNum==lesseeMes.pages?'4':lesseeMes.pageNum+1}" aria-label="Next">
						        <span aria-hidden="true">&raquo;</span>
						      </a>
						    </li>
						  </ul>
						</nav>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<script type="text/javascript">
		function deleteLessee(i,path){
			var rs = confirm("确认要删除该房间的数据？删除后将无法恢复！")
			if(rs)
				window.location.href = path+"/lessee/deleteLesseeById?id="+i
		}
	
	</script>
</body>
</html>